/*
 * ============================================================================
 * Copyright Notice!
 * ----------------------------------------------------------------------------
 * This file contains proprietary and confidential information belonging to the
 * group of people involvled in developing this project.  Reproduction, disclosure 
 * or use without specific written authorization from project stake holders is 
 * prohibited. Please refer the readme.txt in project installation folder for more
 * specific contacts
 *
 * All rights reserved.
 * ============================================================================
 */
package edu.uwm.universitydb.dao.professor;

import java.sql.PreparedStatement;
import java.sql.SQLException;

import edu.uwm.universitydb.framework.transactional.db.command.impl.TransactionalDataManipulationCommandBase;

/**
 * <code>InsertProfessorWorkDepartmentCommand</type>
 * 
 * @author Shyam Nair
 */
public class InsertProfessorWorkDepartmentCommand extends TransactionalDataManipulationCommandBase
{
    /** SQL query for performing insert */
    private static final String SQL = "insert into university.works (prof_ssn, dno) values (?,?);";

    /** attribute holding the professor entry to be inserted */
    private final String mSsn;

    /** attribute holding the deptno */
    private final Integer mDno;

    /**
     * 
     * @param ssn
     * @param dno
     */
    public InsertProfessorWorkDepartmentCommand(final String ssn, final Integer dno)
    {
        mSsn = ssn;
        mDno = dno;
    }

    /*
     * (non-javadoc)
     * @see edu.uwm.universitydb.framework.db.command.DBCommand#getSQL()
     */
    @Override
    public String getSQL()
    {
        return SQL;
    }

    /*
     * (non-javadoc)
     * @see edu.uwm.universitydb.framework.db.command.DBCommand#setParameters(java.sql.PreparedStatement)
     */
    @Override
    public void setParameters(final PreparedStatement pStmt) throws SQLException
    {
        // set ssn
        pStmt.setString(1, mSsn);
        // set dept num
        pStmt.setInt(2, mDno);
    }
}

/*
 * ============================================================================
 * Change History
 * ----------------------------------------------------------------------------
 * Apr 30, 2014   Shyam Nair
 * File created
 * ----------------------------------------------------------------------------
 */